﻿//JumbotCms_4.1 Final
using System;
using System.Data;
using System.Web;
using Jumbot.Common;
namespace JumbotCms.Extends.Comment
{
    public partial class _toplist : JumbotCms.Common.BasicPage
    {
        private string _response = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            string ccid = Str2Str(q("ccid"));
            string id = Str2Str(q("id"));
            int PSize = (Str2Int(q("pagesize"), 0) < 1 || Str2Int(q("pagesize"), 0) > 20) ? 10 : Str2Int(q("pagesize"), 0);
            int page = Int_ThisPage();
            string sqlStr = "";
            int countNum = 0;
            string whereStr = " [ParentId]=0";
            if (ccid != "0") whereStr += " AND [ChannelId]=" + ccid;
            if (id != "0") whereStr += " AND [ContentId]=" + id;
            doh.Reset();
            doh.ConditionExpress = whereStr;
            countNum = doh.Count("jcms_extends_comment");

            sqlStr = Jumbot.Common.staticFunction.GetSql("Id,ChannelId,ContentId,IP,UserName,AddDate,Content", "jcms_extends_comment", "id", PSize, page, "desc", whereStr);
            doh.Reset();
            doh.SqlCmd = sqlStr;
            DataTable dtComment = doh.GetDataTable();
            string ResponseStr = "<ul>";
            for (int j = 0; j < dtComment.Rows.Count; j++)
            {
                ResponseStr += "<li><a href=\"" + Go2View(doh, 1, false, dtComment.Rows[j]["ChannelId"].ToString(), dtComment.Rows[j]["ContentId"].ToString()) + "\" target=\"_blank\">" + dtComment.Rows[j]["Content"].ToString() + "</a></li>";
            }
            ResponseStr += "</ul>";
            dtComment.Clear();
            dtComment.Dispose();
            Response.Write(Jumbot.Common.Strings.Html2Js(ResponseStr));

        }
    }
}
